//
//  SuperViewController.swift
//  主题切换
//
//  Created by 王帅强 on 2019/1/14.
//  Copyright © 2019 王帅强. All rights reserved.
//

import UIKit

class SuperViewController: UIViewController, ThemeManagerProtocol {



    override func viewDidLoad() {
        super.viewDidLoad()
        registNotification()

        

    }

    func registNotification() {
        NotificationCenter.default.addObserver(self, selector: #selector(handelNotification(notification:)), name: ThemeNotifacationName, object: nil)
    }

    @objc func handelNotification(notification: NSNotification) {
        guard let theme = notification.object as? ThemeProtocol else {
            return
        }
        view.backgroundColor = theme.backgroundColor
    }
    
    deinit {
        NotificationCenter.default.removeObserver(self)
    }
}
